package com.market.service.wx.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.market.bean.MarketFootprint;
import com.market.bean.MarketFootprintExample;
import com.market.bean.common.BasePageInfo;
import com.market.bean.common.CommonData;
import com.market.bean.vo.wx.WxFootprintListVo;
import com.market.mapper.MarketFootprintMapper;
import com.market.mapper.MarketGoodsMapper;
import com.market.service.wx.WxFootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author:WalterChan
 * @Decription:WxFootptintServiceImpl
 * @Date Created in 2023-01-02-12:23
 */
@Service
public class WxFootptintServiceImpl implements WxFootprintService {
    @Autowired
    MarketFootprintMapper marketFootprintMapper;


    @Override
    public CommonData<WxFootprintListVo> list(BasePageInfo info, Integer userId) {
//        获取分页
        PageHelper.startPage(info.getPage(),info.getLimit());
        List<WxFootprintListVo>list = marketFootprintMapper.selectFootPrintCrossGoodsByUserId(userId);

        PageInfo<WxFootprintListVo> pageInfo = new PageInfo<>(list);
        return CommonData.data(pageInfo);


    }

    @Override
    public void delete(Integer valueOf,Integer userId) {
        Date date = new Date();
        MarketFootprint marketFootprint = new MarketFootprint();
        marketFootprint.setDeleted(true);
        marketFootprint.setUpdateTime(date);
        marketFootprint.setId(valueOf);
        marketFootprint.setUserId(userId);

        int result = marketFootprintMapper.updateByPrimaryKeySelective(marketFootprint);



    }
}
